package com.visionet.school.app.web.wechat.utils;

import com.alibaba.fastjson.JSONObject;
import com.visionet.school.app.web.wechat.vo.MainVO;

public class MediaUtil {
	/*
	 * 上传文件到微信
	 * 返回的是上传成功后的media_id
	 * null时表示失败
	 */
	public static String UpdateMedia(String filePath, String media_type) {
		String urlString= MainVO.GetMediaUrl("upload",media_type);
		String datasString=DataTransfer.PostFileToWeiXin(urlString, filePath);
		return JSONObject.parseObject(datasString).getString("media_id");
	}
}
